package com.hpjpw.ido.controller;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hpjpw.ido.domain.MessageRemind;
import com.hpjpw.ido.service.IMessageRemindService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 评论提醒Controller
 * 
 * @author hpj
 * @date 2021-04-04
 */
@Api(value ="MessageRemindController")
@RestController
@RequestMapping("/ido/remind")
public class MessageRemindController extends BaseController
{
    @Autowired
    private IMessageRemindService messageRemindService;

    /**
     * 查询评论提醒列表
     */
    @PreAuthorize("@ss.hasPermi('ido:remind:list')")
    @GetMapping("/list")
    @ApiOperation("查询评论提醒列表")
    public TableDataInfo list(MessageRemind messageRemind)
    {
        startPage();
        List<MessageRemind> list = messageRemindService.selectMessageRemindList(messageRemind);
        return getDataTable(list);
    }

    /**
     * 导出评论提醒列表
     */
    @PreAuthorize("@ss.hasPermi('ido:remind:export')")
    @Log(title = "评论提醒", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    @ApiOperation("导出评论提醒列表")
    public AjaxResult export(MessageRemind messageRemind)
    {
        List<MessageRemind> list = messageRemindService.selectMessageRemindList(messageRemind);
        ExcelUtil<MessageRemind> util = new ExcelUtil<MessageRemind>(MessageRemind.class);
        return util.exportExcel(list, "remind");
    }

    /**
     * 获取评论提醒详细信息
     */
    @PreAuthorize("@ss.hasPermi('ido:remind:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取评论提醒详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(messageRemindService.selectMessageRemindById(id));
    }

    /**
     * 新增评论提醒
     */
    @PreAuthorize("@ss.hasPermi('ido:remind:add')")
    @Log(title = "评论提醒", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增评论提醒")
    public AjaxResult add(@RequestBody MessageRemind messageRemind)
    {
        return toAjax(messageRemindService.insertMessageRemind(messageRemind));
    }

    /**
     * 修改评论提醒
     */
    @PreAuthorize("@ss.hasPermi('ido:remind:edit')")
    @Log(title = "评论提醒", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改评论提醒")
    public AjaxResult edit(@RequestBody MessageRemind messageRemind)
    {
        return toAjax(messageRemindService.updateMessageRemind(messageRemind));
    }

    /**
     * 删除评论提醒
     */
    @PreAuthorize("@ss.hasPermi('ido:remind:remove')")
    @Log(title = "评论提醒", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除评论提醒")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(messageRemindService.deleteMessageRemindByIds(ids));
    }
}
